﻿using MongoDB.Driver;
using System;

namespace GT.Framework.Mongo.Core
{
    public class DoMongoBase : IDisposable
    {
        public static IMongoDatabase Core { get; private set; }
        private bool _disposed = false;
        static DoMongoBase()
        {
            Core = MongoManager.GetClient();
        }


        protected virtual void Dispose(bool disposing)
        {
            if (!this._disposed)
            {
                if (disposing)
                {
                    // 释放链接
                    // Core.Disconnect();
                    Core = null;
                }
            }
            this._disposed = true;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
    }
}
